

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Show Employee</title>
    </head>
    <body>
        <div class="undernav">
          <span class="menuButton"><g:link class="createEmployee" action="create">New Employee</g:link></span>
        </div>
        <div class="body">
            <h1>Show Employee</h1>
            <g:if test="${flash.message}">
              <div class="message">${flash.message}</div>
            </g:if>
            <div style="width: 100%;">
              <table>
                <tr>
                  <td>
                    <div class="dialog" style="float:left;">
                      <h2 style="margin-left:8px;">Person details</h2>
                      <table width="100%" style="border:none;">
                          <tbody>
                              <tr>
                                <td valign="top" class="name"><b>Title:</b> ${fieldValue(bean:employeeInstance, field:'title')}</td>
                              </tr>
                              <tr class="prop">
                                <td valign="top" class="name"><b>Name:</b> ${fieldValue(bean:employeeInstance, field:'firstName')} ${fieldValue(bean:employeeInstance, field:'lastName')}</td>
                              </tr>
                              <tr class="prop">
                                <td valign="top" class="name"><b>Date of Birth</b>: <g:formatDate date="${employeeInstance.dob}" format="yyyy-MM-dd"/></td>
                              </tr>
                              <tr>
                                <td valign="top" class="name"><b>Address:</b> ${fieldValue(bean:employeeInstance, field:'street')}, ${fieldValue(bean:employeeInstance, field:'zipCode')} ${fieldValue(bean:employeeInstance, field:'city')}</td>
                              </tr>
                              <tr>
                                <td valign="top" class="name"><b>Email:</b> ${fieldValue(bean:employeeInstance, field:'email')}</td>
                              </tr>

                          </tbody>
                      </table>
                    </div>
                    <div class="dialog" style="float:right; margin-left:85px;">
                      <h2 style="margin-left:8px;">Work details</h2>
                      <table width="100%" style="border:none;">
                        <tbody>
                          <tr class="prop">
                            <td valign="top" class="name"><b>User Name:</b> ${fieldValue(bean:employeeInstance, field:'userName')}</td>
                          </tr>
                          <tr class="prop">
                            <td valign="top" class="name"><b>Salary:</b> ${fieldValue(bean:employeeInstance, field:'salary')}</td>
                          </tr>
                          <tr>
                            <td valign="top" class="name"><b>Percentage Work:</b> ${fieldValue(bean:employeeInstance, field:'percentageWork')} %</td>
                          </tr>
                          <tr>
                            <td valign="top" class="name"><b>Hours Per Year:</b> <g:formatNumber number="${employeeInstance.workingHoursPerYear}" format="###"/> h</td>
                          </tr>
                          <g:if test="${employeeInstance.admin}">
                            <tr class="prop">
                              <td valign="top" class="value">Has admin rights</td>
                            </tr>
                          </g:if>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>
                    <g:if test="${!employeeInstance.projects.empty}">
                      <div class="dialog" style="width:100%; margin-top:25px;">
                        <h2>Projects</h2>
                        <table style="margin-top:10px">
                          <thead>
                            <tr>
                              <th>Project</th>
                              <th>Hours</th>
                              <th>Percent</th>
                            </tr>
                          </thead>
                          <tbody>
                            <g:each var="p" in="${employeeInstance.projects}">
                              <tr>
                                <td><g:link controller="project" action="show" id="${p.id}">${p}</g:link></td>
                                <td>250h</td>
                                <td>34%</td>
                              </tr>
                            </g:each>
                          </tbody>
                        </table>
                      </div>
                    </g:if>
                    <div class="buttons">
                      <g:form>
                          <input type="hidden" name="id" value="${employeeInstance?.id}" />
                          <span class="button"><g:actionSubmit class="editEmployee" value="Edit" /></span>
                          <span class="button"><g:actionSubmit class="deleteEmployee" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                      </g:form>
                    </div>
                  </td>
                </tr>
              </table>
            </div>
        </div>
    </body>
</html>
